package com.example.app.network.api

import com.example.app.data.bean.BaseResponseData
import com.example.app.data.bean.routeTask.TaskItem
import com.example.app.network.createWebService
import com.example.app.util.CacheUtil
import retrofit2.http.*

interface TaskService {
    companion object {
        var service = createWebService(
            ServiceConfig.SERVER_URL,
            TaskService::class.java
        )
    }
    /*删除一条账目*/
    @DELETE("task/remove")
    suspend fun taskRemoveOne(
        @Query("CreatorId") CreatorId: String? = CacheUtil.getUserId(),
        @Query("_id") _id: String,
    ): BaseResponseData<Any>
    //查询任务
    @GET("task/get")
    suspend fun taskGet(
        @Query("CreatorId") CreatorId: String? = CacheUtil.getUserId(),
    ): BaseResponseData<MutableList<TaskItem>>
    //新增任务
    @FormUrlEncoded
    @POST("task/addTask")
    suspend fun addTask(
        @Field("CreatorId") CreatorId: String? = CacheUtil.getUserId(),
        @Field("Title") Title: String? = null,
        @Field("State") State: String? = null,
        @Field("Message") Message: String? = null,
        @Field("NotificationId") NotificationId: Int? = null,
        @Field("CalendarId") CalendarId: Long? = null,
        @Field("EventId") EventId: Long? = null,
        @Field("CalendarName") CalendarName: String? = null,
        @Field("ExpirationTime") ExpirationTime: String? = null,
    ): BaseResponseData<Any>
    //更新任务
    @FormUrlEncoded
    @POST("task/updateTask")
    suspend fun updateTask(
        @Field("_id") _id: String? = null,
        @Field("CreatorId") CreatorId: String? = CacheUtil.getUserId(),
        @Field("Title") Title: String? = null,
        @Field("State") State: String? = null,
        @Field("Message") Message: String? = null,
        @Field("NotificationId") NotificationId: Int? = null,
        @Field("ExpirationTime") ExpirationTime: String? = null,
        @Field("CalendarId") CalendarId: Long? = null,
        @Field("EventId") EventId: Long? = null,
        @Field("CalendarName") CalendarName: String? = null,
    ): BaseResponseData<Any>
}

